﻿using JuCheap.Core.Infrastructure;
using JuCheap.Core.Infrastructure.Utilities;
using JuCheap.Core.Model;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace JuCheap.Core.IService.AppService
{
    /// <summary>
    /// 用户扩展服务
    /// </summary>
    public interface IUserService
    {
        /// <summary>
        /// 创建用户
        /// </summary>
        /// <param name="userReq"></param>
        /// <returns></returns>
        Task<string> CreateAsync(UserCreateRequestDto userReq);

        /// <summary>
        /// 修改用户
        /// </summary>
        /// <param name="userReq">用户请求信息</param>
        /// <returns>用户Id</returns>
        Task<string> UpdateAsync(UserEditRequestDto userReq);

        /// <summary>
        /// 登陆
        /// </summary>
        /// <param name="loginName">账号</param>
        /// <param name="password">密码</param>
        /// <returns></returns>
        Task<CurrentUserDto> LoginAsync(string loginName, string password);

        /// <summary>
        /// 用户角色设置
        /// </summary>
        /// <param name="userRoleDto"></param>
        /// <returns></returns>
        Task SetRolesAsync(UserRoleSetRequestDto userRoleDto);

        /// <summary>
        /// 获取用户拥有的角色Id集合
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <returns></returns>
        Task<IEnumerable<string>> GetUserRoleIdsAysnc(string userId);

        /// <summary>
        /// 获取用户拥有的菜单权限信息
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <returns></returns>
        Task<IEnumerable<SysMenuDto>> GetUserMenusAsync(string userId);

        /// <summary>
        /// 修改密码
        /// </summary>
        /// <param name="changePasswordDto">密码修改模型</param>
        /// <returns></returns>
        Task<bool> ChangePasswordAsync(UserChangePasswordDto changePasswordDto);

        /// <summary>
        /// 更新个人信息
        /// </summary>
        /// <param name="profile">基本资料</param>
        /// <returns></returns>
        Task<bool> UpdateProfileAsync(UserProfileUpdateDto profile);

        /// <summary>
        /// 加载菜单树状结构
        /// </summary>
        /// <param name="userId">用户 Id</param>
        /// <param name="loadAction">是否加载非菜单的数据</param>
        /// <param name="loadSystem">是否加载系统菜单的数据</param>
        /// <returns></returns>
        Task<List<MenuResponseDto>> GetMenuTreeAsync(string userId, bool loadAction, bool loadSystem);

        /// <summary>
        /// 验证是否有权限
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <param name="permissionCode">权限唯一编码</param>
        /// <returns></returns>
        Task<bool> HasPermissionAsync(string userId, string permissionCode);

        /// <summary>
        /// 用户分页扩展方法
        /// </summary>
        /// <param name="filter">基础分页参数</param>
        /// <returns></returns>
        Task<PagedResult<SysUserDto>> QueryPagesAsync(SysUserFilter filter);
    }
}
